
// const Vue = require('vue')
// const Vuex = require('vuex')
// import Vue from 'vue'
// import Vuex from 'vuex'
// Vue.use(Vuex)
// const userStore = require('./modules/user')
// const store = () => {
//     return new Vuex.Store({
//         namespaced: true,
//         modules: {
//             userStore
//         },
//         actions: {
//             async nuxtServerInit({ commit }, { req, app }) {
//                 const { status, data: { username } } = await app.$axios.get("/user/getUser");
//                 if (status == 200) {
//                     console.log(`${username} --store/index.js`)
//                     commit('/userStore/setUsername', username)
//                 }
//             }
//         }
//     })
// }
// export default store

export const actions = {
    async nuxtServerInit({ commit }, { req, app }) {
        const { status, data: { username } } = await app.$axios.get("/user/getUser");
        if (status == 200) {
            console.log(`${username} --store/index.js`)
            commit('user/setUsername', username)
        }
    }
}